package com.huabo.contract.mysql.mapper;

import com.hbfk.util.PageInfo;
import com.huabo.contract.oracle.entity.TblLegalQualification;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author huabo
 * @since 2022-03-22
 */
public interface TblLegalQualificationMySqlMapper extends BaseMapper<TblLegalQualification> {

    @SelectProvider(type=TblLegalQualificationMySqlMapperSqlConfig.class,method="findListByPageInfo")
    List<TblLegalQualification> findListByPageInfo(PageInfo<TblLegalQualification> pageInfo, TblLegalQualification qualification,Integer disputeid);

    @SelectProvider(type=TblLegalQualificationMySqlMapperSqlConfig.class,method="findListByPageInfoCount")
    Integer findListByPageInfoCount(TblLegalQualification qualification,Integer disputeid);

    @Select("select * from TBL_LEGAL_QUALIFICATION tlq " +
            "LEFT JOIN TBL_LEGAL_DISPUTREGISTRATION tld on tlq.DISPUTEINFO = tld.DISPUTEID " +
            "WHERE QUALID = #{qualId}")
    TblLegalQualification findByQualId(Integer qualId);

    @InsertProvider(type=TblLegalQualificationMySqlMapperSqlConfig.class,method="saveQualification")
    @Options(useGeneratedKeys=true, keyProperty="qualid", keyColumn="QUALID")
    void saveQualification(TblLegalQualification qualification);

    @UpdateProvider(type=TblLegalQualificationMySqlMapperSqlConfig.class,method="updateModifyQualification")
    void updateModifyQualification(TblLegalQualification old);

    @Delete("DELETE FROM TBL_LEGAL_QUALIFICATION WHERE QUALID = #{qualId}")
    void removeQualification(Integer qualId);
}
